#ifndef ERROR_H
#define ERROR_H

#include <stdio.h>
#include <stdlib.h>

#define COLOR_RED     "\x1b[31m"
#define COLOR_GREEN   "\x1b[32m"
#define COLOR_RESET   "\x1b[0m"

#define PRINT_ERROR_EXIT(errorMsg) \
do { \
  fprintf(stderr, COLOR_RED "%s:%d: %s!\n" COLOR_RESET, __FILE__, __LINE__, errorMsg); \
  exit(EXIT_FAILURE); \
} while(0)

#define PRINT_SYSTEM_ERROR_EXIT(error) \
do { \
  fprintf(stderr, COLOR_RED "%s:%d: ", __FILE__, __LINE__); \
  perror(error); \
  fprintf(stderr, COLOR_RESET); \
  exit(EXIT_FAILURE); \
} while(0)

#endif // ERROR_H
